Skip to main content

hahnavi's blog

How to Install MEGAcmd on Gentoo Linux (from source)

How to Install MEGAcmd on Gentoo Linux (from source)

hahnavi hahnavi

MEGAcmd is MEGA’s official CLI, and on Gentoo it’s easiest to build from source. The MEGA SDK snapshot used here needs a small ffmpeg compile fix (the same patch used in the Arch AUR). The steps below pull the exact sources, apply the patch, then build and install.

Download sources and patch

curl -OL "https://github.com/meganz/MEGAcmd/archive/1.7.0_Linux.tar.gz"
curl -OL "https://github.com/meganz/sdk/archive/e448c09e73a4496329f46e538f1f20143b618ed1.tar.gz"
curl -OL "https://aur.archlinux.org/cgit/aur.git/plain/fix-ffmpeg-compile.patch?h=megacmd"

Extract

tar xf 1.7.0_Linux.tar.gz
tar xf e448c09e73a4496329f46e538f1f20143b618ed1.tar.gz

Prepare the tree

cd MEGAcmd-1.7.0_Linux

Replace the bundled SDK with the one we just downloaded:

How to Install PostgreSQL Server on Ubuntu 24.04 (Noble)

hahnavi hahnavi

Below are the steps to install PostgreSQL from the PGDG repository.

Install the PGDG helper

This installs the apt.postgresql.org.sh script.

sudo apt install -y postgresql-common

Add the PostgreSQL Apt repository

This script adds the PGDG repo and its signing key for the current Ubuntu release.

sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh

Install PostgreSQL

This pulls the server packages from the PGDG repo.

sudo apt -y install postgresql

Sanity check

Check that the service is running and the local connection works.

Auto Backup PostgreSQL Database Using pg_dump and cron

Auto Backup PostgreSQL Database Using pg_dump and cron

hahnavi hahnavi

This is a simple, no‑frills way to take daily PostgreSQL backups with pg_dump and cron. The script writes timestamped dumps and keeps only the last 7 days.

1. Create a backup script

Create the script file:

vi /path/to/backup_script.sh

Add the content below. Swap the database credentials and backup directory.

#!/bin/bash

# Database credentials
DB_NAME="your_database_name"
DB_USER="your_database_user"
DB_PASSWORD="your_database_password"

# Backup directory
BACKUP_DIR="/path/to/backup/directory"
mkdir -p $BACKUP_DIR

# Date format for backup file
DATE=$(date +%Y-%m-%d_%H-%M-%S)

# Backup file name
BACKUP_FILE="$BACKUP_DIR/${DB_NAME}_$DATE.sql"

# Export password to avoid prompt
export PGPASSWORD=$DB_PASSWORD

# Perform the backup
pg_dump -U $DB_USER -d $DB_NAME -F c -f $BACKUP_FILE

# Unset the password
unset PGPASSWORD

# Optional: Delete backups older than 7 days
find $BACKUP_DIR -type f -name "*.sql" -mtime +7 -exec rm {} \;

echo "Backup completed successfully at $DATE"

Make it executable:

How to take a screenshot in Sway using slurp, grim, and swappy

How to take a screenshot in Sway using slurp, grim, and swappy

hahnavi hahnavi

slurp lets you draw a box on screen and outputs the geometry.

grim grabs the pixels from your Wayland compositor.

swappy is a lightweight screenshot editor for Wayland (think Snappy on macOS).

Install on Arch Linux

sudo pacman -S slurp grim swappy

Bind it to the Print key

Add this line to your Sway config: ~/.config/sway/config

bindsym Print exec grim -g "$(slurp)" - | swappy -f -

Reload Sway and you’re done.

Free Cloud PostgreSQL Databases

Free Cloud PostgreSQL Databases

hahnavi hahnavi

Quick list of free (or free‑tier) cloud PostgreSQL options. Limits change over time, so double‑check before committing to anything long‑term.

1. Neon

Serverless Postgres. Free plan limits are per project.

  • 100 CU-hours per month per project
  • 0.5 GB storage per project
  • Compute sizes up to 2 CU (8 GB RAM)
  • Features: branching, autoscaling, read replicas

2. Supabase

Free plan limits are per project.

  • 500 MB database size
  • 5 GB egress
  • 1 GB file storage
  • 50,000 monthly active users

3. Aiven

Managed Postgres with a free plan and clear resource limits.